package com.letoo.sso.common.utils;

import java.util.UUID;

/**
 * JAVA UUID工具类
 * 
 * @author dengjie
 *
 */
public class UUIDUtils {

    /**
     * 获得一个UUID
     * 
     * @return StringUUID
     */
    public static String getUUID() {
        String s = UUID.randomUUID().toString();
        // 去掉“-”符号
        return s.substring(0, 8) + s.substring(9, 13) + s.substring(14, 18) + s.substring(19, 23) + s.substring(24);
    }

    /**
     * 获得指定数目标UUID
     * 
     * @param number
     *            int 必需获得的UUID数量
     * @return String[] UUID数组
     */
    public static String[] getUUID(int number) {
        if (number < 1) {
            return null;
        }
        String[] ss = new String[number];
        for (int i = 0; i < number; i++) {
            ss[i] = getUUID();
        }

        return ss;
    }

}
